/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function joinEvent(eventId) {
    var jqxhr = $.post(JOIN_EVENT_URL, {"event.eventId":eventId},
    function(data) {
      var getData = $.parseJSON(data);
      alert(getData);
    })
    .success(function() {
        $("#btnJoinEvent").empty();
    })
    .error(function() {
        alert('Co loi xay ra');
    })
    .complete(function() {  });
}
function writeEventComment(topicId) {    
    var content = $("#box5").find('textarea').val();
    var jqxhr= $.ajax({
       type: "POST",
       url: WRITE_COMMENT_URL,
       async:false,
       global: false,
       data: "topic.topicId="+topicId+"&post.postContent="+content,
       success: function(msg){
         var newhtml = $("#box_comment4").html();
         var textcomment = $(newhtml).find("span").replaceWith(aaaasdd);
         alert(textcomment);
         alert(newhtml);
         newhtml = "<li class='box_comment'>" + newhtml + "</li>"
         $("#Topic5").find('ul').append(newhtml);
       },
       error: function(msg){
         alert( "Loi xay ra: " + msg );
       }
     });
     return false;
}
function switchComment(topicId) {
   if(topicId == null) {
        $("#btn_comment").removeClass("hide");
   } else {
    $("#btn_comment_" + topicId).removeClass("hide");
   }
}

